import request from '@/utils/request'


export function getList(query) {
  return request({
    url: '/api/device/list',
    method: 'get',
    params: query
  })
}

export function getCharge() {
  return request({
    url: '/api/charge_option/all',
    method: 'get',
  })
}


export function create(data) {
  return request({
    url: '/api/device/create',
    method: 'post',
    data
  })
}


export function del(id) {
  return request({
    url: '/api/device/delete',
    method: 'get',
    params: { id }
  })
}

export function updateUrl(iot,value) {
  return request({
    url: '/api/update_url',
    method: 'get',
    params: {
      iot_sn:iot,
      path:value
    }
  })
}
export function unbind(id) {
  return request({
    url: '/api/device/unbind',
    method: 'get',
    params: { id }
  })
}

export function reset(id) {
  return request({
    url: '/api/device/reset',
    method: 'get',
    params: { id }
  })
}

export function readParams(id) {
  return request({
    url: '/api/device/read_params',
    method: 'get',
    params: { id }
  })
}

export function chargeDetail(id) {
  return request({
    url: '/api/device/show_charge',
    method: 'get',
    params: {
      id:id
    }
  })
}


export function signalList(id) {
  return request({
    url: '/api/device/signal_list',
    method: 'get',
    params: {
      device_id:id
    }
  })
}

export function batchChange(ids,disIds) {
  return request({
    url: '/api/device/batch_change',
    method: 'get',
    params: { ids:ids,disIds:disIds }
  })
}

export function updateParams(data) {
  return request({
    url: '/api/device/update_params',
    method: 'post',
    data
  })
}

export function startPort(data) {
  return request({
    url: '/api/device/start_port',
    method: 'post',
    data
  })
}

export function changeStatus(val, id) {
  return request({
    url: '/api/device/change_status',
    method: 'get',
    params: {
      id: id,
      status: val
    }
  })
}

export function getQrImg(sn) {
  return request({
    url: '/api/device/qr_code',
    method: 'get',
    params: {
      deviceId:sn
    }
  })
}
